package com.qb.video.ui.activity

import android.os.Bundle
import cn.jzvd.Jzvd
import cn.jzvd.JzvdStd
import com.alibaba.android.arouter.facade.annotation.Route
import com.blankj.utilcode.util.LogUtils
import com.qb.baselibrary.basekotlin.BaseActivity
import com.qb.baselibrary.basekotlin.EmptyViewModel
import com.qb.common.router.RouterPath
import com.qb.video.CustomMedia.JZMediaExo
import com.qb.video.databinding.VideoActivityVideoResumeBinding


@Route(path = RouterPath.URL_Video_VideoResumeActivity)
class VideoResumeActivity : BaseActivity<EmptyViewModel,VideoActivityVideoResumeBinding>() {
    var playUrl:String?=null
    var name:String?=null
    override fun initView(savedInstanceState: Bundle?) {
        if (!playUrl.isNullOrEmpty()){
//            mBinding.jzVideo.setUp(playUrl, name)
//            mBinding.jzVideo.posterImageView.setImageResource(R.drawable.ic_menu_compass)
//            mBinding.jzVideo.setMediaInterface(JZMediaIjk::class.java)
            mBinding.jzVideo.setUp(playUrl,name,JzvdStd.SCREEN_NORMAL,JZMediaExo::class.java)
            mBinding.jzVideo.startVideoAfterPreloading()
        }
    }

    override fun initData() {
        playUrl = intent.getStringExtra("playUrl")
        name = intent.getStringExtra("name")
        LogUtils.e("==-->$playUrl $name")
    }

    override fun onBackPressed() {
        if (Jzvd.backPress()) {
            return
        }
        super.onBackPressed();
    }

    override fun onPause() {
        super.onPause()
        Jzvd.releaseAllVideos();
    }
}